package com.xbongbong.saas.service;

import com.xbongbong.paas.field.FieldAttrEntity;
import com.xbongbong.paas.pojo.FieldAttrEntityForImport;
import com.xbongbong.paas.pojo.dto.FormDataAddDTO;
import com.xbongbong.paas.pojo.dto.FormDataGetDTO;
import com.xbongbong.paas.pojo.dto.ImportFormDataDTO;
import com.xbongbong.paas.pojo.imports.CellTitlePojo;
import com.xbongbong.paas.pojo.imports.RowGroupPojo;
import com.xbongbong.paas.pojo.vo.FormDataAddVO;
import com.xbongbong.paas.pojo.vo.FormDataDeleteBatchVO;
import com.xbongbong.paas.pojo.vo.FormDataGetVO;
import com.xbongbong.paas.pojo.vo.PaasFormDataEsListVO;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.wrap.BaseVO;
import com.xbongbong.pro.applist.pojo.vo.ListAppVO;
import com.xbongbong.pro.formdata.pojo.dto.FormDataDetailDTO;
import com.xbongbong.pro.formdata.pojo.vo.FormDataDetailVO;
import com.xbongbong.pro.knowledge.base.pojo.dto.BatchDealTagDTO;
import com.xbongbong.pro.knowledge.base.pojo.dto.KnowledgeAddDTO;
import com.xbongbong.pro.knowledge.base.pojo.dto.KnowledgeListDTO;
import com.xbongbong.pro.knowledge.base.pojo.dto.KnowledgeOperationDTO;
import com.xbongbong.pro.knowledge.base.pojo.vo.KnowledgeVO;

import java.util.List;

/**
 * 知识库条目处理接口
 *
 * @author ruansicheng
 * @version v1.0
 * @date 2022/06/21
 * @since v1.0
 */

public interface KnowledgeDataService {
    /**
     * 新增知识条目
     *
     * @param knowledgeAddDTO
     * @throws XbbException 业务异常
     * @author ruansicheng
     * @date 2021/11/19 2:13
     */
    FormDataAddVO addKnowledge(KnowledgeAddDTO knowledgeAddDTO) throws XbbException;

    /**
     * 批量删除知识条目
     *
     * @param knowledgeOperationDTO
     * @throws XbbException 业务异常
     * @author ruansicheng
     * @date 2022/06/29 2:13
     */
    FormDataDeleteBatchVO deleteBatch(KnowledgeOperationDTO knowledgeOperationDTO) throws XbbException;

    /**
     * 编辑获取知识条目数据
     *
     * @param knowledgeOperationDTO
     * @throws XbbException 业务异常
     * @author ruansicheng
     * @date 2022/06/29 2:13
     */
    KnowledgeVO knowledgeUpdateGet(KnowledgeOperationDTO knowledgeOperationDTO) throws XbbException;

    /**
     * 更新知识条目
     *
     * @param knowledgeAddDTO
     * @throws XbbException 业务异常
     * @author ruansicheng
     * @date 2022/06/29 2:13
     */
    KnowledgeVO update(KnowledgeAddDTO knowledgeAddDTO) throws XbbException;

    /**
     * 启用/停用知识条目
     *
     * @param knowledgeOperationDTO
     * @throws XbbException 业务异常
     * @author ruansicheng
     * @date 2022/06/29 2:13
     */
    FormDataDeleteBatchVO  setupKnowledge(KnowledgeOperationDTO knowledgeOperationDTO) throws XbbException;

    /**
     * 获取知识条目列表
     *
     * @param knowledgeListDTO
     * @throws XbbException 业务异常
     * @author ruansicheng
     * @date 2022/06/29 2:13
     */
    PaasFormDataEsListVO listByEs(KnowledgeListDTO knowledgeListDTO) throws XbbException;

    /**
     * 从es获取知识条目
     *
     * @param knowledgeListDTO
     * @throws XbbException 业务异常
     * @author ruansicheng
     * @date 2022/06/29 2:13
     */
    PaasFormDataEsListVO knowledgeList(KnowledgeListDTO knowledgeListDTO, List<FieldAttrEntity> explainList) throws XbbException;

    /**
     * 移动端知识条目列表
     *
     * @param knowledgeListDTO
     * @throws XbbException 业务异常
     * @author ruansicheng
     * @date 2022/06/29 2:13
     */
    ListAppVO appKnowledgeDataList(KnowledgeListDTO knowledgeListDTO) throws XbbException;

    /**
     * web 知识条目详情tab
     *
     * @param formDataDetailDTO
     * @throws XbbException 业务异常
     * @author ruansicheng
     * @date 2022/06/29 2:13
     */
    FormDataDetailVO getWebDetail(FormDataDetailDTO formDataDetailDTO) throws XbbException;

    /**
     * web 知识条目详情数据
     *
     * @param formDataGetDTO
     * @throws XbbException 业务异常
     * @author ruansicheng
     * @date 2022/06/29 2:13
     */
    FormDataGetVO get(FormDataGetDTO formDataGetDTO) throws XbbException;

    /**
     * app 知识条目详情数据
     *
     * @param formDataGetDTO
     * @throws XbbException 业务异常
     * @author ruansicheng
     * @date 2022/06/29 2:13
     */
    FormDataGetVO appKnowledgeDetail(FormDataGetDTO formDataGetDTO) throws XbbException;

    /**
     * 将Excel数据格式化成表单保存需要的JSON格式的数据
     *
     * @param importFormDataDTO 导入入参
     * @param titlePojoList     标题
     * @param rowGroupPojo      一个表单对应的一组Excel填写的数据
     * @param fieldAttrList     解释
     * @return FormDataAddDTO
     * @throws XbbException XbbException
     */
    FormDataAddDTO formatExcelValue(ImportFormDataDTO importFormDataDTO, List<CellTitlePojo> titlePojoList, RowGroupPojo rowGroupPojo, List<FieldAttrEntityForImport> fieldAttrList) throws XbbException;
    /**
     * 导入知识条目
     *
     * @param formDataAddDTO 导入入参
     * @return FormDataAddDTO
     * @throws XbbException XbbException
     */
    void importKnowledges(FormDataAddDTO formDataAddDTO) throws XbbException;
    /**
     * 批量操作-移除标签
     * @param batchDealTagDTO
     * @return
     */
    BaseVO batchRemoveTag(BatchDealTagDTO batchDealTagDTO) throws XbbException;
    /**
     * 批量操作-新增标签
     * @param batchDealTagDTO
     * @return
     */
    BaseVO batchAddTag(BatchDealTagDTO batchDealTagDTO) throws XbbException;
}
